function methodInfo(methodName,data){
    this.method=methodName
    this.data=data
}
let serverOrigin=location.origin;
let serverUrl = serverOrigin+'/api';
//let serverUrl='http://led.longder.com:8080/mine_ceshi/v1'
let code_success=200;
var sensorServer= {
    //向服务器法送数据
    postServerData: function (postUrl, postData) {
        $.ajaxSettings.async = false;
        this.filterMineByInfo(postData);
        var url = postUrl;
        var serverResultData;
        var jsonData = JSON.stringify(postData);
        $.ajax({
            //请求类型，这里为POST
            // xhrFields:{
            //     withCredentials:true
            // },
            type: 'POST', //你要请求的api的URL
            url: url, //是否使用缓存
            cache: false, //数据类型，这里我用的是json
            dataType: "json",
            contentType: "application/json;charset=utf-8",
            //必要的时候需要用JSON.stringify() 将JSON对象转换成字符串
            data: jsonData, //data: {key:value},
            //添加额外的请求头
            headers: {'Access-Control-Allow-Origin': '*', "token": window.localStorage.getItem("token")}, //请求成功的回调函数
            success: function (data) {
                //函数参数 "data" 为请求成功服务端返回的数据
                if (data.code==500&&data.msg==401){
                    //console.log("重新登录！");
                    layer.msg("请重新登陆！",{icon:1,time:1000});
                    //window.open("./login.html");
                    //window.open("./login.html", "_blank", "resizable,scrollbars,status");
                    top.location.href ="login.html"; //这种可以新页打开
                    //window.parent.location.replace("login.html");//刷新父级页面; 这种可以新页打开
                }
                if(data.code==8001){
                    layer.msg('无权限操作!',{icon:2,time:2000});
                }
                serverResultData = data.data;
            }
        });
        $.ajaxSettings.async = true;
        return serverResultData;
    },
    postServerDataSync: function (postUrl, postData) {
        //   $.ajaxSettings.async = false;
        var url = postUrl;
        var serverResultData = false;
        var jsonData = JSON.stringify(postData)
        $.ajax({
            //请求类型，这里为POST
            type: 'POST', //你要请求的api的URL
            url: url, //是否使用缓存
            cache: false, //数据类型，这里我用的是json
            dataType: "json",
            contentType: "application/json;charset=utf-8",
            //必要的时候需要用JSON.stringify() 将JSON对象转换成字符串
            data: jsonData, //data: {key:value},
            //添加额外的请求头
            headers: {'Access-Control-Allow-Origin': '*', "token": window.localStorage.getItem("token")}, //请求成功的回调函数
            success: function (data) {
                serverResultData = data.data;
                return data.data;
            }
        });
        // $.ajaxSettings.async = true;
        return serverResultData;
    },
    //获得已经登录人的信息
    getLoginUserInfo:function(){
        //return localStorage.getItem("robotUser");
        return JSON.parse(localStorage.getItem("robotUser"));
    },
    //加过滤矿 使用 this.filterMineByInfo(postData);
    filterMineByInfo:function(postData){
        //如果有就别管
        if(postData.hasOwnProperty("minesId"))
            return;
        if(this.getLoginUserInfo()==null)
            postData.minesId=0;
        else
            postData.minesId=this.getLoginUserInfo().minesId;
        //return postData;
    },    //获取传感器数据 list
    getFundList: function (postData) {
        //debugger;
        //this.filterMineByInfo(postData);
        var url = serverUrl + "/Fund/getFundList";
        $.ajaxSettings.async = false;
        return sensorServer.postServerData(url, postData);
    },
    //修改基金
    updateFund: function (postData) {
        //$.ajaxSettings.async = false;
        var url = serverUrl + "/Fund/update";
        return sensorServer.postServerData(url, postData);
    },
    //获取传感器数据 list
    getSensorList: function (postData) {
        //debugger;
        //this.filterMineByInfo(postData);
        var url = serverUrl + "/sensor/list";
        $.ajaxSettings.async = false;
        return sensorServer.postServerData(url, postData);
    },
    //修改传感器数据
    updateSensorInfo1: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensor/update";
        return sensorServer.postServerData(url, postData);
    },
    //新增传感器数据
    addSensorInfo: function (postData) {
        // var url=serUrl;
        // var postData=new methodInfo("AddSensor",jsonData)
        // jsonData=JSON.stringify(postData)
        // $.post(url,jsonData,function (data) {
        //     console.log(data);
        //     return data;
        // },'json')
        // return null;
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensor/addSensor";
        return sensorServer.postServerData(url, postData);
    },
    delSensorInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensor/delete";
        return sensorServer.postServerData(url, postData);
    },

    //获取LED  数据
    getLedList: function (postData) {
        //this.filterMineByInfo(postData);
        var url = serverUrl + "/led/list";
        $.ajaxSettings.async = false;
        return sensorServer.postServerData(url, postData);
    },
    //获取LED 根据ID 数据
    getLedListByPid: function (postData) {
        var url = serverUrl + "/led/list/pid";
        $.ajaxSettings.async = false;
        return sensorServer.postServerDataSync(url, postData);
    },
    //新增LED
    addLedInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/led/add";
        return sensorServer.postServerDataSync(url, postData);
    },
    //删除LED
    delLedInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/led/del";
        return sensorServer.postServerData(url, postData);
    },
    //修改LED
    updateLedInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/led/update";
        return sensorServer.postServerData(url, postData);
    },

    //获取传感器采集的数据
    getSensorDataListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensorData/list";
        return sensorServer.postServerData(url, postData);
    },
    //获取报警记录的数据
    getWarningListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/list";
        return sensorServer.postServerData(url, postData);
    },
    //获取报警记录的数据 (汇总的报警)
    getWarningSummaryListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/summary/list";
        return sensorServer.postServerData(url, postData);
    },
    //获取报警记录的数据 (ID)
    getWarningSummaryById: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/summary/byId";
        return sensorServer.postServerData(url, postData);
    },
    //删除汇总的报警
    delWarningSummary: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/summary/del";
        return sensorServer.postServerData(url, postData);
    },
    //修改汇总的报警
    updateWarningSummary: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/summary/update";
        return sensorServer.postServerData(url, postData);
    },
    updateWarningInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/update";
        return sensorServer.postServerData(url, postData);
    },
    //获取断网记录的数据
    getLogNetworkListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/log/networkList";
        return sensorServer.postServerData(url, postData);
    },
    //获取断网记录的数据 汇总
    getLogNetworkListByPageGather: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/log/networkList/gather";
        return sensorServer.postServerData(url, postData);
    },
    //获取刷屏记录的数据
    getLogLedListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/log/ledLogList";
        return sensorServer.postServerData(url, postData);
    },
    //获得电源列表
    getBatteryListByPage: function (postData) {
        //this.filterMineByInfo(postData);
        $.ajaxSettings.async = false;
        var url = serverUrl + "/battery_info/list";
        return sensorServer.postServerData(url, postData);
    },
    //删除电源列表
    deleteBatteryInfo: function (postData) {
        debugger;
        $.ajaxSettings.async = false;
        let url = serverUrl + "/battery_info/delete";
        return sensorServer.postServerData(url, postData);
    },
    //获得电源详细
    getBatteryDetailsListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/battery_details/list";
        return sensorServer.postServerData(url, postData);
    },
    //删除 获取断网记录的数据
    deleteLogNetworkListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/log/networkList/delete";
        return sensorServer.postServerData(url, postData);
    },
    //删除一条告警记录
    deleteWarning: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warning/delete";
        return sensorServer.postServerData(url, postData);
    },
    //修改最大报警值设置
    updateMaxSetting: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/max_setting/update";
        return sensorServer.postServerData(url, postData);
    },
    //修改最大报警值设置 可批量根据设备ID 修改
    updateMaxSettingBySensorPid: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/max_setting/updateBySensorPid";
        return sensorServer.postServerData(url, postData);
    },

    //修改最大报警值设置
    getMaxSetting: function (postData) {
        //this.filterMineByInfo(postData);
        $.ajaxSettings.async = false;
        var url = serverUrl + "/max_setting/list";
        return sensorServer.postServerData(url, postData);
    },
    //删除最大设置
    delMaxSetting: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/max_setting/del";
        return sensorServer.postServerData(url, postData);
    },
    //根据小时获取折线图数据  最大值
    getSensorDataListByHour: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensorData/line/chart";
        var resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },
    //根据天获取折线图数据  最大值
    getSensorDataListByDay: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensorData/line/chart1";
        var resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },
    //根据小时获取折线图数据  平均值
    getSensorDataListByHourAVG: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensorData/line/chart/avg";
        var resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },
    //根据指定的地点获取 历史数据
    getSensorDataListByDate: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/sensorData/list/byDate";
        var resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },
    //获取班报数据
    getSensorDataListByByBanci: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/report/base/list";
        var resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },

    //获取班报模板
    getReportModeList: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/report/model/list";
        var resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },

    //获取班报模板
    exportReportByModel: function (modelPath, day, banci) {
        $.ajaxSettings.async = false;

        let mId=0;
        if(this.getLoginUserInfo()==null)
            mId=0;
        else
            mId=this.getLoginUserInfo().minesId;

        var url = serverUrl + modelPath + "?day=" + day + "&banci=" + banci+"&minesId="+mId;
       // open(url);
        downLoadByUrl(url);
    },

    //ping ip 是否通讯
    ipConnect: function (postData) {
        // $.ajaxSettings.async = false;
        var url = serverUrl + "/sensor/ping";
        var resultData = sensorServer.postServerDataSync(url, postData);
        return resultData;
    },
    //登陆
    loginAccount: function (postData) {
        var url = serverUrl + "/login";
        return sensorServer.postServerData(url, postData);
    },
    //获取登录人信息
    getLoginUserInfo:function(){
        let loginUser=JSON.parse(localStorage.getItem("robotUser"));
        return loginUser;
    },
    //是否连接中控室
    isConnectControlPC: function (postData) {
        var url = serverUrl + "/app_heartbeat/getLastAppHeartBeat";
        return sensorServer.postServerData(url, postData);
    },
    //获取断网记录的数据
    getSetGasListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/logSetGas/setGasList";
        return sensorServer.postServerData(url, postData);
    },
    //------------------------------------------------上传文件 通用接口----------------------------------------------------------------
    uploadFileInfoToServer: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/upload/info";
        return sensorServer.postServerData(url, postData);
    },
    //获取上传上传文件URL
    getUploadFileUrl: function () {
        return url = serverUrl + "/upload/info";
    },
    //获取上传上传文件URL
    getUploadFileUrl1: function () {
        return url = serverUrl + "/upload/info1";
    },
    //获取转换CAD文件URL
    getConvertCADUrl: function () {
        return url = serverUrl + "/upload/convertCAD";
    },
    //修改系统设置
    updateSettingsInfo: function (postData) {
        //this.filterMineByInfo(postData);
        $.ajaxSettings.async = false;
        var url = serverUrl + "/settings/update";
        return sensorServer.postServerData(url, postData);
    },

    //根据APP key 获取设置的Val
    getSettingsByAppKey: function (postData) {
        //this.filterMineByInfo(postData);
        let url = serverUrl + "/settings/getByAppkey";
        let resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },

    //保存发布的文本
    saveContentUeditor: function (postData) {
        let url = serverOrigin + "/ueditor/savaContent";
        let resultData = sensorServer.postServerData(url, postData);
        return resultData;
    },

    //获取报警手机号
    getWarningPhoneListByPage: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warningphone/phone/list";
        return sensorServer.postServerData(url, postData);
    },
    //删除获取报警手机号
    delWarningPhoneList: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warningphone/delWaringPhone";
        return sensorServer.postServerData(url, postData);
    },
    //删除获取报警手机号
    addWarningPhoneList: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warningphone/addWaringPhone";
        return sensorServer.postServerData(url, postData);
    },
    //
    updateWarningPhoneList: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/warningphone/updateWaringPhone";
        return sensorServer.postServerData(url, postData);
    },
    //根据电源ID 获取电源信息
    getBatteryInfoById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/battery_info/byId";
        return sensorServer.postServerData(url, postData);
    },
    //根据电源ID 修改电源信息
    updateBatteryInfo: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/battery_info/update";
        return sensorServer.postServerData(url, postData);
    },
    //按小时导出最大值或者平均值
    GetExport: function (params) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/reportChart/info?" + params;
        open(url);
    },
    //获取今日待办
    getTodayThingsList: function (postData) {
        //this.filterMineByInfo(postData);
        $.ajaxSettings.async = false;
        var url = serverUrl + "/todayThings/list";
        return sensorServer.postServerData(url, postData);
    },
    deleteTodayThings: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/todayThings/del";
        return sensorServer.postServerData(url, postData);
    },
    //修改 今日待办
    updateTodayThings: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/todayThings/update";
        return sensorServer.postServerData(url, postData);
    },
    //添加 今日待办
    addTodayThings: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/todayThings/add";
        return sensorServer.postServerData(url, postData);
    },
    //获取账户列表
    getAccountList: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/account/list";
        return sensorServer.postServerData(url, postData);
    },
    getAccountInfoById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/account/byId";
        return sensorServer.postServerData(url, postData);
    },
    //增加账号
    addAccount: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/account/add";
        return sensorServer.postServerData(url, postData);
    },
    //修改账号
    updateAccount: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/account/update";
        return sensorServer.postServerData(url, postData);
    },
    //删除账号
    delAccount: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/account/del";
        return sensorServer.postServerData(url, postData);
    },
    //获取角色列表
    getRoleList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/role/list";
        return sensorServer.postServerData(url, postData);
    },
    //获取微调列表
    getSettingsSensorList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/settingsSensor/list";
        return sensorServer.postServerData(url, postData);
    },
    //微调列表 -修改
    updateSettingsSensor: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/settingsSensor/update";
        return sensorServer.postServerData(url, postData);
    },
    //微调列表 -新增
    addSettingsSensor: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/settingsSensor/add";
        return sensorServer.postServerData(url, postData);
    },
    //微调列表 -删除
    delSettingsSensor: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/settingsSensor/del";
        return sensorServer.postServerData(url, postData);
    },
    //是否是管理员
    getRoleIsAdmin: function () {
        let loginUser = JSON.parse(localStorage.getItem("robotUser"));
        if (loginUser.roleId == 1)
            return true;
        return false;
    },
    //修改 断网记录
    updateLogNetworkGather: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/log/networkList/gather/update";
        return sensorServer.postServerData(url, postData);
    },
    //获取矿维护人员列表
    getMaintainPersonListByPage: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/maintainPerson/list";
        return sensorServer.postServerData(url, postData);
    },
    //获取矿维护人员列表
    updateMaintainPerson: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/maintainPerson/update";
        return sensorServer.postServerData(url, postData);
    },
    addMaintainPerson: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/maintainPerson/add";
        return sensorServer.postServerData(url, postData);
    },
    delMaintainPerson: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/maintainPerson/del";
        return sensorServer.postServerData(url, postData);
    },
    //智能客服的接口 1=================================================================================
    getMinesList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getMinesList";
        return sensorServer.postServerData(url, postData);
    },
    //智能客服的接口 2
    getMinesInfoById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getMinesInfoById";
        return sensorServer.postServerData(url, postData);
    },
    //智能客服的接口 3
    updateMines: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/updateMines";
        return sensorServer.postServerData(url, postData);
    },
    //删除维护矿信息
    delMinesInfo: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/del";
        return sensorServer.postServerData(url, postData);
    },
    //刷新同步采集的数据
    manualRef: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/manualRef";
        return sensorServer.postServerData(url, postData);
    },
    //客服维护过得记录
    getLogMaintainList: function (postData) {
    $.ajaxSettings.async = false;
    let url = serverUrl + "/customerService/getLogMaintainList";
    return sensorServer.postServerData(url, postData);
   },
    getLogMaintainById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getLogMaintainById";
        return sensorServer.postServerData(url, postData);
    },
    delLogMaintainById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/delLogMaintain";
        return sensorServer.postServerData(url, postData);
    },
    updateLogMaintain: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/updateLogMaintain";
        return sensorServer.postServerData(url, postData);
    },
    addLogMaintain: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/addLogMaintain";
        return sensorServer.postServerData(url, postData);
    },
    getDeliverRecordList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getDeliverRecordList";
        return sensorServer.postServerData(url, postData);
    },
    getDeliverRecordById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getDeliverRecordById";
        return sensorServer.postServerData(url, postData);
    },
    addDeliverRecordList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/addDeliverRecord";
        return sensorServer.postServerData(url, postData);
    },
    updateDeliverRecord: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/updateDeliverRecord";
        return sensorServer.postServerData(url, postData);
    },
    delDeliverRecord: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/delDeliverRecord";
        return sensorServer.postServerData(url, postData);
    },
    saveDeliverRecordAttachment: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/saveDeliverRecordAttachment";
        return sensorServer.postServerData(url, postData);
    },
    getProcessRecordList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getProcessRecordList";
        return sensorServer.postServerData(url, postData);
    },
    getProcessRecordById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getProcessRecordById";
        return sensorServer.postServerData(url, postData);
    },
    addProcessRecord: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/addProcessRecord";
        return sensorServer.postServerData(url, postData);
    },
    updateProcessRecord: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/updateProcessRecord";
        return sensorServer.postServerData(url, postData);
    },
    saveProcessRecordAttachment: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/saveProcessRecordAttachment";
        return sensorServer.postServerData(url, postData);
    },
    saveLogMaintainAttachment: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/saveLogMaintainAttachment";
        return sensorServer.postServerData(url, postData);
    },
    delProcessRecord: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/delProcessRecord";
        return sensorServer.postServerData(url, postData);
    },
    //获取煤矿关联的资源文件
    getMinesAttachmentList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/getMinesAttachmentList";
        return sensorServer.postServerData(url, postData);
    },
    addMinesAttachment: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/addMinesAttachment";
        return sensorServer.postServerData(url, postData);
    },
    delMinesAttachment: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/customerService/delMinesAttachment";
        return sensorServer.postServerData(url, postData);
    },
    //lED关联的 资源
    getLedContentList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/list";
        return sensorServer.postServerData(url, postData);
    },
    //所有LED播放的资源
    getLedAllContentResourcesList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/ResourcesList";
        return sensorServer.postServerData(url, postData);
    },
    //删除资源
    delLedContentResources: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/DelContentResources";
        return sensorServer.postServerData(url, postData);
    },
    updateContentResources: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/UpdateContentResources";
        return sensorServer.postServerData(url, postData);
    },
    //修改资源关联的 屏幕
    updateResourcesLed: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/updateResourcesLed";
        return sensorServer.postServerData(url, postData);
    },


    //根据ID获取资源
    getContentResourcesById: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/GetContentResourcesById";
        return sensorServer.postServerData(url, postData);
    },
    //添加播放的资源
    addContentResources: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/ledContent/AddContentResources";
        return sensorServer.postServerData(url, postData);
    },
    updateShowLedAround: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/led/updateShowLedAround";
        return sensorServer.postServerData(url, postData);
    },
    getShowLedAround: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/led/getShowLedAround";
        return sensorServer.postServerData(url, postData);
    },
    //获取审批报表人员
    getApproveReportAccountList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/approveReport/accountList";
        return sensorServer.postServerData(url, postData);
    },
    //获取审批日志
    getApproveReportLogList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/approveReport/logList";
        return sensorServer.postServerData(url, postData);
    },
    //删除审批报表人员
    delApproveReportAccountList: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/approveReport/del";
        return sensorServer.postServerData(url, postData);
    },
    //新增一条审批报表人员
    addApproveReportAccount: function (postData) {
        $.ajaxSettings.async = false;
        let url = serverUrl + "/approveReport/addApproveAccount";
        return sensorServer.postServerData(url, postData);
    },
    //获取部门列表
    getDeptList: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/dept/list";
        return sensorServer.postServerData(url, postData);
    },
    //修改部门列表
    updateDeptInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/dept/update";
        return sensorServer.postServerData(url, postData);
    },
    addDeptInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/dept/add";
        return sensorServer.postServerData(url, postData);
    },
    delDeptInfo: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/dept/del";
        return sensorServer.postServerData(url, postData);
    },
    //是否有审批权限
    getIsApproveReportAccount:function(postData){
        let url=serverUrl+"/app/getIsApproveReportAccount/";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    //添加审批记录
    addApproveReportLog:function(postData){
        let url=serverUrl+"/app/addApproveReportLog";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    //查询今日是已经否审批
    getIsApproveReport:function(postData){
        let url=serverUrl+"/app/getIsApproveReport";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    //查询所有审批人，那些人批准了，那些人没有批准
    approveDetails:function(postData){
        let url=serverUrl+"/approveReport/approveDetails";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    //修改导出报表
    updateReportBase:function(postData){
        let url=serverUrl+"/report/update";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    //获取班点
    getAllWorkshifts:function(postData){
        let url=serverUrl+"/workshifts/list";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    updateWorkshifts:function(postData){
        let url=serverUrl+"/workshifts/update";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    addSensorTask:function(postData){
        let url=serverUrl+"/sensorTask/add";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    hideSensor:function(postData){
        let url=serverUrl+"/sensor/hide";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },

    //获取班报模板
    exportReportByModelMonth: function (modelPath, startDay, endDay) {
        $.ajaxSettings.async = false;
        var url = serverUrl + modelPath + "?startDay=" + startDay + "&endDay=" + endDay;
        //open(url);
        downLoadByUrl(url);
    },
    getSensorByPid:function (postData) {
        // $.ajaxSettings.async = false;
        let url=serverUrl+"/sensor/getSensorByPid";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    updateMinesAttachment:function (postData) {
        // $.ajaxSettings.async = false;
        let url=serverUrl+"/customerService/updateMinesAttachment";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    getMinesAttachmentType:function (postData) {
        // $.ajaxSettings.async = false;
        let url=serverUrl+"/customerService/getMinesAttachmentType";
        let resultData=sensorServer.postServerData(url,postData);
        return  resultData;
    },
    //登陆日志
    getLogLoginList: function (postData) {
        var url = serverUrl + "/login/logList";
        return sensorServer.postServerData(url, postData);
    },
    //新增矿
    addMine: function (postData) {
        $.ajaxSettings.async = false;
        var url = serverUrl + "/customerService/add";
        return sensorServer.postServerDataSync(url, postData);
    },
    getStoreComponentsList: function (postData) {
        var url = serverUrl + "/customerService/getStoreComponentsList";
        return sensorServer.postServerData(url, postData);
    },
    getStoreComponentsType: function (postData) {
        var url = serverUrl + "/customerService/getStoreComponentsType";
        return sensorServer.postServerData(url, postData);
    },
    getDeviceMaintainList: function (postData) {
        var url = serverUrl + "/customerService/getDeviceMaintainList";
        return sensorServer.postServerData(url, postData);
    },
    getContentList: function (postData) {
        var url = serverUrl + "/content/list";
        return sensorServer.postServerData(url, postData);
    },
    updateContentInfo: function (postData) {
        var url = serverUrl + "/content/update";
        return sensorServer.postServerData(url, postData);
    },
    getDeviceStoreList: function (postData) {
        var url = serverUrl + "/customerService/getDeviceStoreList";
        return sensorServer.postServerData(url, postData);
    },
    getAppMenuListByAccountId: function (postData) {
        var url = serverUrl + "/customerService/getAppMenuListByAccountId";
        return sensorServer.postServerData(url, postData);
    },
    updateAppMenuList: function (postData) {
        var url = serverUrl + "/customerService/updateAppMenuList";
        return sensorServer.postServerData(url, postData);
    },

    //获取传感器数据 list
    getAdmin_SensorList:function(postData){
        var url=serverUrl+"/admin/sensorList";
        $.ajaxSettings.async = false;
        return  sensorServer.postServerData(url,postData);
    },
    //获取LED  数据
    getAdmin_LedList:function(postData){
        var url=serverUrl+"/admin/ledList";
        $.ajaxSettings.async = false;
        return  sensorServer.postServerData(url,postData);
    },
}

function downLoadByUrl(url){
    var xhr = new XMLHttpRequest();
    //GET请求,请求路径url,async(是否异步)
    xhr.open('GET', url, true);
    //设置请求头参数的方式,如果没有可忽略此行代码
    xhr.setRequestHeader("token", window.localStorage.getItem("token"));
    //设置响应类型为 blob
    xhr.responseType = 'blob';
    //关键部分
    xhr.onload = function (e) {
        //如果请求执行成功
        if (this.status == 200) {
            var blob = this.response;
            var filename = "";//如123.xls
            var a = document.createElement('a');

            blob.type = "application/octet-stream";
            //创键临时url对象
            var url = URL.createObjectURL(blob);

            a.href = url;
            a.download=filename;
            a.click();
            //释放之前创建的URL对象
            window.URL.revokeObjectURL(url);
        }
    };
    //发送请求
    xhr.send();
}


